# config for vip-manager by Cybertec Schönig & Schönig GmbH

# time (in milliseconds) after which vip-manager wakes up and checks if it needs to register or release ip addresses.
interval: {{ vip_manager_interval }}

# the etcd or consul key which vip-manager will regularly poll.
trigger-key: "/service/{{ patroni_cluster_name }}/leader"
# if the value of the above key matches the trigger-value (often the hostname of this host), vip-manager will try to add the virtual ip address to the interface specified in Iface
trigger-value: "{{ ansible_hostname }}"

ip: {{ vip_manager_ip }} # the virtual ip address to manage
netmask: {{ vip_manager_mask }} # netmask for the virtual ip
interface: {{ vip_manager_iface }} # interface to which the virtual ip will be added

# how the virtual ip should be managed. we currently support "ip addr add/remove" through shell commands or the Hetzner api
hosting-type: basic # possible values: basic, or hetzner.

dcs-type: {{ dcs_type }} # etcd or consul
# a list that contains all DCS endpoints to which vip-manager could talk.
{% if not dcs_exists|bool and dcs_type == 'etcd' %}
dcs-endpoints:
{% for host in groups['etcd_cluster'] %}
  - http://{{ hostvars[host]['inventory_hostname'] }}:2379
{% endfor %}
{% endif %}
{% if dcs_exists|bool and dcs_type == 'etcd' %}
dcs-endpoints:
{% for etcd_hosts in patroni_etcd_hosts %}
  - http://{{ etcd_hosts.host }}:{{ etcd_hosts.port }}
{% endfor %}
{% endif %}

  # consul will always only use the first entry from this list.
  # For consul, you'll obviously need to change the port to 8500.

#etcd-user: "patroni"
#etcd-password: "Julian's secret password"

# when etcd-ca-file is specified, TLS connections to the etcd endpoints will be used.
#etcd-ca-file: "/path/to/etcd/trusted/ca/file"
# when etcd-cert-file and etcd-key-file are specified, we will authenticate at the etcd endpoints using this certificate and key.
#etcd-cert-file: "/path/to/etcd/client/cert/file"
#etcd-key-file: "/path/to/etcd/client/key/file"

# don't worry about parameter with a prefix that doesn't match the endpoint_type. You can write anything there, I won't even look at it.
#consul-token: "Julian's secret token"

# how often things should be retried and how long to wait between retries. (currently only affects arpClient)
retry-num: 2
retry-after: 250  #in milliseconds

# verbose logs (currently only supported for hetzner)
verbose: false
